from time import sleep

from django.db import DatabaseError
from django.http import HttpResponse
from rest_framework.response import Response
from rest_framework.views import APIView


# Create your views here.
def home(request):
    return HttpResponse("HOME")


class HomeView(APIView):
    def get(self, request):
        sleep(0.5)

        raise DatabaseError("mysql连接失败")

        return Response("Hello World")
